package edu.hawaii.duedates.web.page;

import java.util.List;
import edu.hawaii.duedates.DueDates;
import edu.hawaii.duedates.book.Book;
import edu.hawaii.duedates.library.Library;
import edu.hawaii.duedates.web.DueDatesSession;

/**
 * This is the base page used by the DueDates-Omaomao web application pages.
 * 
 * @author Ronn Reeves.
 */
public abstract class DueDatesPage extends BasePage {
  /** Support serialization. */
  private static final long serialVersionUID = 1L;

  /**
   * Returns the session instance associated with the current user.
   * 
   * @return The DueDates Session.
   */
  public DueDatesSession getDueDatesSession() {
    return (DueDatesSession) getSession();
  }

  /**
   * Set the due dates for this user instance.
   */
  public void setDueDates() {
    getDueDatesSession().setDueDates();
  }

  /**
   * Returns the duedates for this user instance.
   * 
   * @return The duedates.
   */
  public DueDates getDueDates() {
    return getDueDatesSession().getDueDates();
  }

  /**        
   * Set the test due dates.        
   */        
  public void setTestDueDates() {        
    getDueDatesSession().setTestDueDates();        
  }
  
  /**
   * Sets the duedates error message.
   * 
   * @param message The error message.
   */
  public void setErrorMessage(String message) {
    getDueDatesSession().setErrorMessage(message);
  }

  /**
   * Returns the duedates error message.
   * 
   * @return The error message.
   */
  public String getErrorMessage() {
    return getDueDatesSession().getErrorMessage();
  }

  /**
   * Sets the user id entered in the login form.
   * 
   * @param uid The user id.
   */
  public void setUserId(String uid) {
    getDueDatesSession().setUserId(uid);
  }

  /**
   * Returns the user id entered in the login form.
   * 
   * @return The user id.
   */
  public String getUserId() {
    return getDueDatesSession().getUserId();
  }

  /**
   * Sets the password entered in the login form.
   * 
   * @param pwd The password.
   */
  public void setPassword(String pwd) {
    getDueDatesSession().setPassword(pwd);
  }

  /**
   * Returns the password entered in the login form.
   * 
   * @return The password.
   */
  public String getPassword() {
    return getDueDatesSession().getPassword();
  }
  
  /**
   * Sets the selected status of this library.
   * 
   * @param library The library.
   * @param selected The selected status.
   */
  public void setSelected(Library library, Boolean selected) {
    getDueDatesSession().setSelected(library, selected);
  }
  
  /**
   * Gets the selected status of the libraries.
   *
   * @param library The library.
   * @return True if selected.
   */
  public Boolean getSelected(Library library) {
    return getDueDatesSession().getSelected(library);
  }

  /**
   * Sets the within period to query results.
   * 
   * @param within The within period.
   */
  public void setWithin(int within) {
    getDueDatesSession().setWithin(within);
  }

  /**
   * Gets the within period to query results.
   * 
   * @return The within period.
   */
  public int getWithin() {
    return getDueDatesSession().getWithin();
  }

  /**
   * Sets the library to query results.
   * 
   * @param library The library.
   */
  public void setLibrary(Library library) {
    getDueDatesSession().setLibrary(library);
  }

  /**
   * Gets the library being queried.
   * 
   * @return The library.
   */
  public Library getLibrary() {
    return getDueDatesSession().getLibrary();
  }

  /**
   * Sets the books from the query.
   * 
   * @param books The list of books.
   */
  public void setBooks(List<Book> books) {
    getDueDatesSession().setBooks(books);
  }

  /**
   * Gets the list of books from the query.
   * 
   * @return The list of books.
   */
  public List<Book> getBooks() {
    return getDueDatesSession().getBooks();
  }
}
